//
//  VOCWordListCell.m
//  iVoc
//
//  Created by Wallace Wu on 09-4-20.
//  Copyright 2009 Sonic Solutions. All rights reserved.
//

#import "VOCWordListCell.h"

@implementation VOCWordListCell

@dynamic favorImg;
@dynamic showStar;

-(UIImageView*)favorImg
{
    if(!favorImg)
    {
        favorImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"favorite.png"]];
    }
    return favorImg;
}

-(void)setShowStar:(BOOL)choice
{    
    self.favorImg.hidden = !choice;
}

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
        // Initialization code
        [self addSubview:self.favorImg];
    }
    return self;
}

- (void)layoutSubviews
{
    CGRect imgRect = self.favorImg.frame;
    
    // position image correctly
    imgRect.origin.y = (self.frame.size.height-imgRect.size.height)/2;
    imgRect.origin.x = self.frame.size.width - 40;
    self.favorImg.frame = imgRect;
    
    [super layoutSubviews];
}

- (void)dealloc {
    [favorImg release];
    [super dealloc];
}


@end
